import 'package:fsharing/core/models/order_list.dart';
import 'package:json_annotation/json_annotation.dart';

part 'order_detail.g.dart';

@JsonSerializable()
class OrderDetail {
  final Order model;
  @JsonKey(defaultValue: [])
  final List<Invoice> invoices;

  OrderDetail(this.model, this.invoices);

  factory OrderDetail.fromJson(Map<String, dynamic> json) => _$OrderDetailFromJson(json);

  Map<String, dynamic> toJson() => _$OrderDetailToJson(this);
}

@JsonSerializable()
class Invoice {
  final String expressNumber;
  final String extNumber;
  final String expressCode;
  final String expressCompany;

  Invoice(this.expressNumber, this.extNumber, this.expressCode, this.expressCompany);

  factory Invoice.fromJson(Map<String, dynamic> json) => _$InvoiceFromJson(json);

  Map<String, dynamic> toJson() => _$InvoiceToJson(this);
}
